package a.f.n;

import a.a.h;
import a.a.kb;
import a.c.bb;
import a.c.e;
import a.c.j;
import a.c.x;
import a.d.f;
import a.f.cd;
import a.f.o;

import java.util.ArrayList;
import java.util.List;

public class r
  extends k
{
  public static final Object o = "LayeredNodePlacer.DP_KEY_DISTANCE_TO_PARENT_MAP";
  public static final int p = 0;
  public static final int q = 1;
  private k.c_ r = k.c_.g;
  private double s = 0.5D;
  private double t = 0.3D;
  private boolean u;
  private boolean v = false;
  private Object w;
  static final double x = 40.0D;
  private double y = 40.0D;
  private int z;
  public static boolean A;
  
  public r(k.b_ paramb_, Object paramObject)
  {
    super(paramb_);
    this.w = paramObject;
  }
  
  public r()
  {
    this(k.b_.a, "TheDefaultKey");
  }
  
  public boolean e()
  {
    return this.v;
  }
  
  public void a(boolean paramBoolean)
  {
    this.v = paramBoolean;
  }
  
  protected byte d(e parame)
  {
    return 0;
  }
  
  protected v a(e parame, byte paramByte)
  {
    boolean bool2 = k.n;
    boolean bool1 = k.m;
    v localv1 = a(parame);
    if (!bool2)
    {
      if (parame.e() == 0) {
        a(parame, paramByte, localv1);
      }
    }
    else {
      return localv1;
    }
    a.c.k localk = this.h.c(o);
    if (!bool2) {
      if (localk == null) {
        throw new IllegalStateException("distances not set!");
      }
    }
    c_ localc_ = (c_)localk.get(parame);
    ab localab1 = new ab(b().a(), this.h.k(parame));
    double d1 = localab1.h() + localab1.c() * this.s;
    double d2 = d1 + localc_.a();
    a.d.w localw = new a.d.w(0.0D, d2 + this.y * this.t);
    db.c_ localc_1 = new db.c_(localw);
    Object localObject1 = null;
    int i = 0;
    a.c.d locald = parame.h();
    e locale;
    v localv2;
    Object localObject2;
    label357:
    do
    {
      if (locald == null) {
        break;
      }
      locale = locald.f();
      localv2 = b(locale);
      localObject2 = (c_)localk.get(locale);
      double d3 = a(localc_, (c_)localObject2);
      double d4 = d1 + d3;
      ab localab2 = new ab(b().a(), this.h.k(locale));
      double d5 = localab2.h() + localab2.c() * this.s;
      double d6 = d4 - d5;
      localv2.h(d6);
      if (bool2) {
        break label481;
      }
      if (bool1) {
        break label478;
      }
      if (localObject1 != null)
      {
        f localf = localObject1.a(1);
        if (!bool2) {
          if (i == 0)
          {
            if (bool2) {
              break label357;
            }
            if (localc_.d() - ((c_)localObject2).d() >= -1) {
              break label391;
            }
          }
        }
        if (!bool2) {}
        i = localc_.d() - ((c_)localObject2).d() < -1 ? 1 : 0;
        localf = new f(localf.a(), localf.b(), localf.d());
        localv2.d(localf, this.g);
      }
      localv2.l();
      localv2.n();
      if (!bool2) {
        if (localObject1 == null)
        {
          localObject1 = localv2;
          if (bool2) {
            continue;
          }
          if (!bool1) {
            break label444;
          }
        }
      }
      localObject1.a(localv2);
      locald = locald.i();
    } while (!bool1);
    label391:
    label444:
    this.r.a(localv1, this.l, this.g);
    if (!bool2) {
      label478:
      localv1.n();
    }
    label481:
    locald = parame.h();
    label546:
    label625:
    label633:
    label634:
    do
    {
      if (locald == null) {
        break;
      }
      locale = locald.f();
      if (bool2) {
        return localv1;
      }
      if (bool1) {
        break label673;
      }
      if (!bool2)
      {
        if (!f()) {
          if (bool2) {
            break label546;
          }
        }
      }
      else if (!m())
      {
        if (bool2) {
          break label634;
        }
        if (!e()) {
          break label633;
        }
      }
      localv2 = b(locale);
      localObject2 = a(locald, localv2);
      if (!bool2)
      {
        if (!f())
        {
          if (bool2) {
            break label625;
          }
          if (!e()) {}
        }
        else
        {
          ((db.a_)localObject2).a(localc_1);
          ((db.a_)localObject2).f(1);
        }
      }
      else
      {
        if (bool2) {
          break label625;
        }
        if (f()) {
          ((db.a_)localObject2).e(0);
        }
      }
      ((db.a_)localObject2).h();
      if (!bool2)
      {
        if (bool1) {
          this.h.e(locald).b();
        }
        locald = locald.i();
      }
    } while (!bool1);
    localv1.a(this.l);
    if (!bool2) {
      label673:
      a(parame, paramByte, localv1);
    }
    return localv1;
  }
  
  private double a(c_ paramc_1, c_ paramc_2)
  {
    boolean bool2 = k.n;
    boolean bool1 = k.m;
    double d = paramc_1.a() + paramc_2.b() + (paramc_2.d() - paramc_1.d()) * this.y;
    b_ localb_ = paramc_1.e();
    int i = paramc_1.d() + 1;
    do
    {
      if (i >= paramc_2.d()) {
        break;
      }
      c_ localc_ = localb_.b(i);
      if (!bool2)
      {
        if (bool1) {
          break label101;
        }
        d += localc_.a() + localc_.b();
        i++;
      }
    } while (!bool1);
    label101:
    return d;
  }
  
  private boolean f()
  {
    if (!k.n) {}
    return this.z == 1;
  }
  
  private void a(e parame, byte paramByte, v paramv)
  {
    boolean bool2 = k.n;
    boolean bool1 = k.m;
    if (this.z == 0) {
      return;
    }
    if (parame.i() == null) {
      return;
    }
    cd localcd = c(parame);
    db.b_ localb_ = a(parame, paramv);
    if (!bool2)
    {
      switch (paramByte)
      {
      case 0: 
        if (!bool2)
        {
          switch (localcd.b())
          {
          case 1: 
          case 3: 
          case 5: 
          case 6: 
          case 7: 
          default: 
            if (!bool2) {
              if (!bool1) {
                break label581;
              }
            }
          case 4: 
            localb_.b(0, true);
            if (bool2) {
              return;
            }
            if (!bool1) {
              break label581;
            }
          case 2: 
            localb_.e(0, true);
            localb_.c(0, true);
            if (bool2) {
              return;
            }
            if (!bool1) {
              break label581;
            }
          }
          localb_.c(0, true);
          if (bool2) {
            return;
          }
        }
        if (!bool1) {
          break;
        }
      case 1: 
        if (!bool2)
        {
          switch (localcd.b())
          {
          case 1: 
            localb_.d(1, true);
            if (bool2) {
              return;
            }
            if (!bool1) {
              break label581;
            }
          case 3: 
          case 4: 
          case 5: 
          case 6: 
          case 7: 
          default: 
            if (!bool2) {
              if (!bool1) {
                break label581;
              }
            }
          case 2: 
            localb_.e(0, true);
            if (bool2) {
              return;
            }
            if (!bool1) {
              break label581;
            }
          }
          localb_.c(0, true);
          localb_.d(1, true);
          if (bool2) {
            return;
          }
        }
        if (!bool1) {
          break;
        }
      case 2: 
        if (!bool2) {
          switch (localcd.b())
          {
          case 1: 
            localb_.d(0, true);
            localb_.c(1, true);
            if (bool2) {
              return;
            }
            if (!bool1) {
              break;
            }
          case 4: 
            localb_.b(1, true);
            if (bool2) {
              return;
            }
            if (!bool1) {
              break;
            }
          case 2: 
            localb_.e(0, true);
            localb_.c(1, true);
            if (bool2) {
              return;
            }
            if (!bool1) {
              break;
            }
          case 3: 
          case 5: 
          case 6: 
          case 7: 
          case 8: 
          default: 
            localb_.c(1, true);
            if (bool2) {
              return;
            }
            break;
          }
        } else {
          if (!bool1) {
            break;
          }
        }
        break;
      case 3: 
        if (!bool2) {}
        switch (localcd.b())
        {
        case 1: 
          localb_.d(0, true);
          if (bool2) {
            return;
          }
          if (!bool1) {
            break;
          }
        case 4: 
          localb_.b(0, true);
          localb_.d(1, true);
          if (bool2) {
            return;
          }
          if (!bool1) {
            break;
          }
        case 2: 
          localb_.e(0, true);
          if (bool2) {
            return;
          }
          if (bool1) {
            break;
          }
        }
        break;
      }
      label581:
      paramv.l();
    }
  }
  
  public ib a(d paramd, o paramo, e parame)
  {
    boolean bool = k.n;
    a.c.k localk = paramo.c(o);
    if ((bool) || ((localk != null) && (localk.get(parame) != null))) {
      return null;
    }
    Object localObject;
    if (this.v)
    {
      localObject = new a_(paramd, paramo, parame);
      if (bool) {
        break label107;
      }
      ((a_)localObject).a(this.g);
      if (!k.m) {}
    }
    else
    {
      localObject = new d_(paramd, paramo, parame);
      ((d_)localObject).a(this.g);
    }
    label107:
    return localObject;
  }
  
  public k.c_ g()
  {
    return this.r;
  }
  
  public void a(k.c_ paramc_)
  {
    this.r = paramc_;
  }
  
  public double h()
  {
    return this.s;
  }
  
  public void b(double paramDouble)
  {
    this.s = paramDouble;
  }
  
  public Object i()
  {
    return this.w;
  }
  
  public double j()
  {
    return this.y;
  }
  
  public void c(double paramDouble)
  {
    this.y = paramDouble;
  }
  
  public void a(int paramInt)
  {
    this.z = paramInt;
  }
  
  public int k()
  {
    return this.z;
  }
  
  public double l()
  {
    return this.t;
  }
  
  public void d(double paramDouble)
  {
    this.t = paramDouble;
  }
  
  public boolean m()
  {
    return this.u;
  }
  
  public void b(boolean paramBoolean)
  {
    this.u = paramBoolean;
  }
  
  static class c_
  {
    private int a;
    private r.b_ c;
    private bb d = new bb();
    private double e;
    private double f;
    private double h;
    private double i;
    
    c_(int paramInt, r.b_ paramb_)
    {
      this.c = paramb_;
      this.a = paramInt;
    }
    
    void a(e parame, v paramv, k.b_ paramb_)
    {
      this.d.add(parame);
      ab localab = new ab(paramb_.a(), this.c.a().d(parame));
      double d1 = localab.h() + localab.c() * this.i;
      double d2 = d1 - paramv.i();
      double d3 = paramv.d() - d1;
      if (!k.n) {
        if (d2 > this.f) {
          this.f = d2;
        }
      }
      if (d3 > this.h) {
        this.h = d3;
      }
    }
    
    void a(e parame, d paramd, k.b_ paramb_, double paramDouble1, double paramDouble2)
    {
      d.a_ locala_ = paramd.i(parame);
      v localv = new v(paramb_, locala_);
      ab localab = new ab(paramb_.a(), this.c.a().d(parame));
      double d1 = localab.h() + localab.c() * this.i;
      double d2 = d1 - localv.i() + paramDouble1;
      double d3 = localv.d() - d1 + paramDouble2;
      if (!k.n) {
        if (d2 > this.f) {
          this.f = d2;
        }
      }
      if (d3 > this.h) {
        this.h = d3;
      }
    }
    
    public double a()
    {
      return this.h;
    }
    
    public double b()
    {
      return this.f;
    }
    
    bb c()
    {
      return this.d;
    }
    
    int d()
    {
      return this.a;
    }
    
    r.b_ e()
    {
      return this.c;
    }
    
    public double f()
    {
      return this.i;
    }
    
    c_ g()
    {
      return r.b_.access$200(e(), this.a + 1);
    }
    
    public double h()
    {
      c_ localc_ = g();
      double d1 = localc_.b();
      return a() + this.e + d1;
    }
    
    public void a(double paramDouble)
    {
      this.e = paramDouble;
    }
    
    public double i()
    {
      return this.e;
    }
    
    public void b(double paramDouble)
    {
      this.i = paramDouble;
    }
  }
  
  class b_
  {
    private List a = new ArrayList();
    private o b;
    private double c;
    
    b_(o paramo)
    {
      this.b = paramo;
    }
    
    r.c_ a(int paramInt)
    {
      if (this.a.size() != paramInt) {
        throw new IllegalStateException("Cannot try to create layer with index " + paramInt + ". First create layer " + this.a.size());
      }
      r.c_ localc_ = new r.c_(paramInt, this);
      localc_.a(r.this.y);
      localc_.b(r.this.s);
      this.a.add(localc_);
      return localc_;
    }
    
    r.c_ b(int paramInt)
    {
      if ((k.n) || (this.a.size() > paramInt)) {
        return (r.c_)this.a.get(paramInt);
      }
      return null;
    }
    
    private r.c_ c(int paramInt)
    {
      if (!k.n) {
        if (this.a.size() <= paramInt) {
          return a(paramInt);
        }
      }
      return (r.c_)this.a.get(paramInt);
    }
    
    o a()
    {
      return this.b;
    }
    
    double b()
    {
      return this.c;
    }
    
    void a(double paramDouble)
    {
      this.c = paramDouble;
    }
    
    List c()
    {
      return this.a;
    }
  }
  
  class a_
    implements ib
  {
    private d a;
    private o b;
    private e c;
    private e d;
    private x e;
    private int f;
    private int g;
    private double h;
    
    a_(d paramd, o paramo, e parame)
    {
      this.a = paramd;
      this.b = paramo;
      this.d = parame;
      x localx = paramo.B();
      this.c = kb.h(paramo);
      kb.b(paramo, localx);
      this.f = localx.getInt(this.c);
      this.g = localx.getInt(parame);
    }
    
    public void a(j paramj1, j paramj2, j paramj3)
    {
      if (!k.n) {
        if (this.b.c(r.o) == null)
        {
          this.e = this.b.B();
          this.b.a(r.o, this.e);
        }
      }
      a((x)this.b.c(r.o), paramj1);
    }
    
    r.b_ a(x paramx, j paramj)
    {
      boolean bool2 = k.n;
      boolean bool1 = k.m;
      r.b_ localb_ = new r.b_(r.this, this.b);
      localb_.a(this.h);
      r.c_[] arrayOfc_ = new r.c_[this.f];
      int i = 0;
      do
      {
        while (!bool1)
        {
          if (i >= this.f) {
            break;
          }
          arrayOfc_[i] = localb_.a(i);
          i++;
        }
      } while (bool2);
      bb localbb = new bb();
      Object localObject2;
      if (!bool2)
      {
        if (!this.b.n())
        {
          localObject1 = this.b.p();
          localObject2 = this.b.v();
          do
          {
            while (!bool1)
            {
              if (!((a.c.w)localObject2).e()) {
                break;
              }
              if (bool1) {
                break label229;
              }
              if (!bool2) {
                if (((a.c.w)localObject2).d().d() == 0)
                {
                  localObject1 = ((a.c.w)localObject2).d();
                  if (!bool2) {
                    if (!bool1) {
                      break;
                    }
                  }
                }
                else
                {
                  ((a.c.w)localObject2).f();
                }
              }
            }
          } while (bool2);
          localObject2 = new r.4(this, localbb);
          ((h)localObject2).a(true);
          ((h)localObject2).a(this.b, (e)localObject1);
        }
        localbb.j();
      }
      label229:
      Object localObject1 = localbb.l();
      label496:
      do
      {
        if (!((a.c.w)localObject1).e()) {
          break;
        }
        localObject2 = ((a.c.w)localObject1).d();
        r.c_ localc_1;
        d.a_ locala_;
        Object localObject3;
        if (!bool2) {
          if (((e)localObject2).e() == 0)
          {
            localc_1 = arrayOfc_[(this.f - 1)];
            locala_ = this.a.i((e)localObject2);
            localObject3 = new v(r.this.i, locala_);
            localc_1.a((e)localObject2, (v)localObject3, r.this.i);
            paramx.a(localObject2, localc_1);
            if (bool2) {
              continue;
            }
            if (!bool1) {
              break label565;
            }
          }
        }
        if (localObject2 == this.c)
        {
          localc_1 = arrayOfc_[0];
          locala_ = this.a.i((e)localObject2);
          localObject3 = new v(r.this.i, locala_);
          localc_1.a((e)localObject2, (v)localObject3, r.this.i);
          paramx.a(localObject2, localc_1);
          if (bool2) {
            continue;
          }
          if (!bool1) {}
        }
        else
        {
          int j = 2147483647;
          localObject3 = ((e)localObject2).q();
          do
          {
            if (!((a.c.w)localObject3).e()) {
              break label496;
            }
            localObject4 = ((a.c.w)localObject3).d();
            r.c_ localc_2 = (r.c_)paramx.get(localObject4);
            if (bool1) {
              break;
            }
            if (localc_2.d() < j) {
              j = localc_2.d();
            }
            ((a.c.w)localObject3).f();
          } while (!bool1);
          localc_1 = arrayOfc_[(j - 1)];
          localObject3 = this.a.i((e)localObject2);
          Object localObject4 = new v(r.this.i, (d.a_)localObject3);
          localc_1.a((e)localObject2, (v)localObject4, r.this.i);
          if (bool2) {
            break;
          }
          paramx.a(localObject2, localc_1);
        }
        ((a.c.w)localObject1).f();
      } while (!bool1);
      label565:
      return localb_;
    }
    
    public void a() {}
    
    public double c()
    {
      return this.h;
    }
    
    public void a(double paramDouble)
    {
      this.h = paramDouble;
    }
  }
  
  class d_
    implements ib
  {
    private d a;
    private final o b;
    private final e c;
    private double d;
    private x e;
    
    d_(d paramd, o paramo, e parame)
    {
      this.a = paramd;
      this.b = paramo;
      this.c = parame;
    }
    
    public void a(j paramj1, j paramj2, j paramj3)
    {
      if (!k.n) {
        if (this.b.c(r.o) == null)
        {
          this.e = this.b.B();
          this.b.a(r.o, this.e);
        }
      }
      a((x)this.b.c(r.o), paramj1);
    }
    
    r.b_ a(x paramx, j paramj)
    {
      boolean bool2 = k.n;
      boolean bool1 = k.m;
      r.b_ localb_ = new r.b_(r.this, this.b);
      localb_.a(this.d);
      bb localbb = new bb();
      label112:
      do
      {
        localbb.add(this.c);
        while (locald == null)
        {
          e locale1;
          gb localgb;
          do
          {
            if (localbb.size() <= 0) {
              break;
            }
            locale1 = localbb.o();
            if ((bool2) || (locale1 != this.c))
            {
              if (bool2) {
                break label112;
              }
              if (locale1.i() != null) {}
            }
            else
            {
              localc_ = localb_.a(0);
              if (!bool1) {
                break label137;
              }
            }
            Object localObject1 = locale1.i().e();
            Object localObject2 = (r.c_)paramx.get(localObject1);
            r.c_ localc_ = ((r.c_)localObject2).g();
            localObject1 = this.a.i(locale1);
            localObject2 = new v(r.this.i, (d.a_)localObject1);
            localc_.a(locale1, (v)localObject2, r.this.i);
            paramx.a(locale1, localc_);
            localgb = (gb)paramj.get(locale1);
          } while ((!bool2) && ((!(localgb instanceof r)) || (!r.this.i().equals(((r)localgb).i()))));
          locald = locale1.h();
        }
        e locale2 = locald.f();
        localbb.add(locale2);
        a.c.d locald = locald.i();
      } while ((!bool2) && ((!bool1) && (!bool1)));
      label137:
      return localb_;
    }
    
    public void a()
    {
      if (!k.n)
      {
        if (this.e != null) {
          this.b.a(this.e);
        }
      }
      else {
        this.b.j(r.o);
      }
    }
    
    public double b()
    {
      return this.d;
    }
    
    public void a(double paramDouble)
    {
      this.d = paramDouble;
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.n.r

 * JD-Core Version:    0.7.0.1

 */